package itdep.common.context.spring;

import itdep.common.domain.Entity;
import org.springframework.security.acls.model.ObjectIdentity;

import java.io.Serializable;

/**
 * @author $Author: ikhalopik $ (latest modification by $Author: ikhalopik $:)
 * @version $Revision: 4 $   $Date: 2010-06-10 13:13:16 +0000 (Thu, 10 Jun 2010) $
 */
public class EntityObjectIdentity<PK extends Serializable, E extends Entity<PK>> implements ObjectIdentity {
	private final E entity;

	public EntityObjectIdentity(E entity) {
		this.entity = entity;
	}

	public PK getIdentifier() {
		return entity.getId();
	}

	public String getType() {
		return entity.getClass().getName();
	}

	public E getEntity() {
		return entity;
	}
}
